/*
 * ********************************************************************* *
  
Copyright HLRS, University Stuttgart

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
* ********************************************************************* *
*/

using System;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace SirLibrary
{
    [DataContract]
    public class EndpointInformation
    {
        public EndpointInformation() { }

        public EndpointInformation(string endpointAddress, ServiceType serviceType)
        {
            this.EndpointAddress = EndpointAddress10.FromEndpointAddress(new EndpointAddress(endpointAddress));
            this.ServiceType = serviceType;
        }

        public EndpointInformation(EndpointAddress10 endpointAddress, ServiceType serviceType) 
        {
            this.EndpointAddress = endpointAddress;
            this.ServiceType = serviceType;
        }

        public Uri GetEndpointAddressAsUri()
        {
            return this.EndpointAddress.ToEndpointAddress().Uri;
        }

        private EndpointAddress10 m_EndpointAddress;

        [DataMember]
        public EndpointAddress10 EndpointAddress
        {
            get { return m_EndpointAddress; }
            set { m_EndpointAddress = value; }
        }

        private ServiceType m_ServiceType;

        [DataMember]
        public ServiceType ServiceType
        {
            get { return m_ServiceType; }
            set { m_ServiceType = value; }
        }
   }
}